<template>
  <div class="app-content-layout">
    <content-sidebar
      class="content-sidebar"
      :isShow="contentSidebarState || screenSize === 'large-screen'"
    ></content-sidebar>

    <div class="main-content">
      <router-view class="content-wrap"> </router-view>
    </div>

    <mine-sidebar
      class="mine-sidebar"
      :isShow="mineSidebarState"
      :style="mineSidebarState ? { zIndex: 20 } : null"
    ></mine-sidebar>

    <transition name="mask-layer-animation">
      <div
        class="mask-layer"
        v-show="hasShowMaskLayer"
        @click="hideSidebar"
        :style="mineSidebarState ? { zIndex: 15 } : null"
      ></div>
    </transition>
  </div>
</template>
<script type="text/ecmascript-6">
import { sidebarMixin } from 'assets/js/mixin'

import MineSidebar from './components/mine-sidebar'

import ContentSidebar from './components/content-sidebar'

export default {
  mixins: [sidebarMixin],
  data() {
    return {

    }
  },
  computed: {
    hasShowMaskLayer() {
      return this.contentSidebarState || this.mineSidebarState
    },
  },
  components: {
    MineSidebar,
    ContentSidebar
  }
}
</script>

<style lang="less" scope >
.app-content-layout {
  position: fixed;
  width: 100%;
  top: 60px;
  bottom: 0;
  overflow: hidden;

  .content-sidebar {
    z-index: 10;
    position: absolute;
    top: 0;
    left: 0;
    width: 250px;
    height: 100%;
    color: #c3c3e2;
    background: #30313f;
    box-shadow: 5px 0 5px 0 rgba(0, 0, 0, 0.2);
  }

  .main-content {
    box-sizing: border-box;
    padding-left: 250px;
    width: 100%;
    height: 100%;
    touch-action: auto;
    overflow: hidden;
    // background: #cbccd7;
    background-color: #191c23;

    .main-wrap {
      width: 100%;
    }

    .content {
      font-size: 25px;
      padding: 50px;
      color: #000;
      text-align: center;
    }
  }

  .mine-sidebar {
    z-index: 10;
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 250px;
    color: #c3c3e2;
    background: #30313f;
    box-shadow: -5px 0 5px 0 rgba(0, 0, 0, 0.2);
  }

  .mask-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
  }
}

@media screen and (max-width: 1280px) {
  .app-content-layout {
    .main-content {
      padding-left: 0;
      box-sizing: border-box;
      width: 100%;
      height: 100%;
      overflow: auto;
    }
  }
}

@media screen and (max-width: 600px) {
  .app-content-layout {
    top: 56px;
  }
}

// 动画
.mask-layer-animation-enter-active,
.mask-layer-animation-leave-active {
  transition: opacity 0.2s ease-out;
}

.mask-layer-animation-enter,
.mask-layer-animation-leave-to {
  opacity: 0;
}
</style>